# Contributor: Thomas Kienlen <kommander@laposte.net>
# Maintainer: Thomas Kienlen <kommander@laposte.net>
pkgname=certstrap
pkgver=1.3.0
pkgrel=13
pkgdesc="Tools to bootstrap CAs, certificate requests, and signed certificates"
url="https://github.com/square/certstrap"
arch="all"
license="Apache-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/square/certstrap/archive/v$pkgver/v$pkgver.tar.gz"
options="chmod-clean"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -trimpath
}

check() {
	# Fix GO 1.18 compatibility
	# https://github.com/golang/go/issues/41682
	# SHA1 support will be removed in GO 1.19
	export GODEBUG=x509sha1=1
	go test -v ./...
}

package() {
	install -Dm755 certstrap "$pkgdir"/usr/bin/certstrap
}

sha512sums="
f3ef9fb9e581acb028f447ac2e2b924a27d6c652d3be30a1df310f7bfde2c8cc40f5ad0fdba0396fbc6bb332c24853aeedee78a00d5217ca02007130e26c5455  certstrap-1.3.0.tar.gz
"
